import Vue from 'vue'
// 2. 导入VueRouter
import VueRouter from 'vue-router'

import Find from '@/views/Find'
import My from '@/views/My'
import Friend from '@/views/Friend'

// 3. 使用vue插件  vue的插件想要生效必须调用一个方法  Vue.use(XXXX)
Vue.use(VueRouter)


import NotFound from '@/views/page404'


// 4. 创建一个路由对象
const router = new VueRouter({
    // 路由的规则
    // route: 一条路由规则
    linkActiveClass: 'act',
    linkExactActiveClass: 'exact',
    routes: [
        // 路径 锚点// 组件
        { path: '/find', component: Find, },
        { path: '/my/:words/:id', name: 'my', component: My, },
        { path: '/friend:words/:id', name: 'friend', component: Friend, },
        { path: '/find', component: Find },
        { path: '/my', component: My },
        { path: '/part', component: Friend },
        // 404在最后(规则是从前往后逐个比较path)
        { path: '*', component: NotFound }],
})

export default router
